home *** CD-ROM | disk | FTP | other *** search
/ Best Tools for JAVA / Best Tools for JAVA.iso / JAVA_ALL / IDE / SUBARTIC / SUB_ARCT / INPUT / USER_INF.JAV < prev    next >
Encoding:
Text File  |  1996-10-04  |  3.1 KB  |  106 lines

  1.  
  2. package sub_arctic.input;
  3.  
  4. import sub_arctic.lib.interactor;
  5.  
  6. /** 
  7.  * Object to encapsulate some information that should be associated 
  8.  * associated with a particular interactor.  These objects are currently used 
  9.  * in picking to record what part or subpart of the object was picked so that 
  10.  * this doesn't need to be recomputed.  
  11.  *
  12.  * @author Scott Hudson
  13.  */
  14. public class user_info_holder
  15.   {
  16.     /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  17.  
  18.     /** The interactor that we are holding information for. */
  19.     public interactor obj = null;
  20.  
  21.     /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  22.  
  23.     /** An object providing the information we are holding. */
  24.     public Object     info  = null;
  25.  
  26.     /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  27.  
  28.     /** 
  29.      * Full constructor. 
  30.      *
  31.      * @param interactor for_obj   object we are associating information with.
  32.      * @param Object     user_info information we are associating.
  33.      */
  34.     public user_info_holder(interactor for_obj, Object user_info)
  35.       {
  36.     obj   = for_obj;
  37.     info  = user_info;
  38.       }
  39.  
  40.     /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  41.  
  42.     /** 
  43.      * Constructor with info defaulting to null. 
  44.      * 
  45.      * @param interactor for_obj object we are associating null information 
  46.      *                           with.
  47.      */
  48.     public user_info_holder(interactor for_obj)
  49.       {
  50.     this(for_obj, null);
  51.       }
  52.  
  53.     /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  54.  
  55.     /** Produce a hash code for the object and info. */
  56.     public int hashCode()
  57.       {
  58.     return  ((obj==null)  ? 0 : obj.hashCode()) ^
  59.             ((info==null) ? 0 : info.hashCode());
  60.       }
  61.  
  62.     /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  63.  
  64.     /** 
  65.      * Generic test for equality.
  66.      *
  67.      * @param Object other object we are testing equality against.
  68.      */
  69.     public boolean equals(Object other)
  70.       {
  71.     if (!(other instanceof user_info_holder)) return false;
  72.     return equals((user_info_holder)other);
  73.       }
  74.  
  75.     /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  76.  
  77.     /** 
  78.      * Type specific test for equality.
  79.      *
  80.      * @param user_info_holder other object we are testing equality against.
  81.      */
  82.     public boolean equals(user_info_holder other)
  83.       {
  84.     return (other.obj == obj) && (other.info == info);
  85.       }
  86.  
  87.     /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  88.  
  89.   }
  90. /*=========================== COPYRIGHT NOTICE ===========================
  91.  
  92. This file is part of the subArctic user interface toolkit.
  93.  
  94. Copyright (c) 1996 Scott Hudson and Ian Smith
  95. All rights reserved.
  96.  
  97. The subArctic system is freely available for most uses under the terms
  98. and conditions described in 
  99.   http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html 
  100. and appearing in full in the lib/interactor.java source file.
  101.  
  102. The current release and additional information about this software can be 
  103. found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
  104.  
  105. ========================================================================*/
  106.